Plans
Introduction
The Plans API enables you to create and manage subscription plans on your platform. It provides functionality for defining plan details, pricing, and access permissions. This section will help you understand how to set up recurring or prepaid plans, assign collections, and manage plan subscriptions, allowing you to offer flexible and tailored access to your content.
Make sure you generated the api_token on your store. More info HERE
Endpoints |
---|
Create |
Update |
Create
POST /integration-api/v1/dashboard/plans
Request Body
Parameter | Type | Description |
---|---|---|
type | string | Valid values: recurring , prepaid , Required |
name | string | |
details | string | |
duration | nullable, integer | |
recommended | boolean | |
private | boolean | |
assigns_collections | boolean | |
concurrency_limit | integer | |
collections | list of collections | |
download_files | boolean | |
prices | list of prices | |
free_trial | boolean | |
free_trial_days | integer | This field can be omitted when free_trial is False |
{
"type":"recurring",
"name":"Demo Plan",
"details":"<div><!--block-->This is the description of the Demo Plan</div>",
"duration":null,
"recommended":true,
"private":false,
"assigns_collections":true,
"concurrency_limit":"1",
"collections":[
"Prepaid"
], // Check special considerations about collections ahead
"download_files":false,
"prices":{
"ARS":0,
"USD":"1",
"EUR":0,
"MXN":"1",
"COP":0,
"PEN":0,
"CLP":0,
"AUD":0,
"UYU":0,
"BOB":0,
"PYG":0,
"BRL":0,
"INR":0,
"GTQ":0,
"HNL":0
},
"free_trial":true,
"free_trial_days":"15"
}
Response
Code | Descriptio |
---|---|
201 | Object Created |
422 | Validation error, the reason of the error will be described in the response |
Assigning Collections
To assign collections to the new plan you may query the following endpoint to get available values for your the collections
GET /integration-api/v1/dashboard/plans/collections
Response Example
{"CODE": "success",
"data": ["Collection 1",
"Testing Collection 2",
"Demo Collection",
"Most Recent",
"Most Read",
"For Children"]}
Retrieve
GET /integration-api/v1/dashboard/plans/
Query Parameters
option | type | endpoint |
---|---|---|
query | string, query parameter | /integration-api/v1/dashboard/plans?query='Test Plan' |
Using query parameter you can search by name, type and details of the plans
Response
Code | Description |
---|---|
200 | Success |
404 | Object not found |
401 | Unauthenticated |
{'CODE': 'success',
'data': {'assigns_collections': True,
'collections': ['Demo Collection 1', 'Demo Collection 2'],
'concurrency_limit': 1,
'created_at': '2021-05-21 15:34:36',
'customer': None,
'deleted_at': None,
'details': 'Este es un plan que servira de aula asociada a un '
'docente',
'download_files': 0,
'duration': 12,
'free_trial': 0,
'free_trial_days': 0,
'has_geolocalized_prices': False,
'id': 2696,
'name': 'Test Plan Name',
'prices': [],
'private': 1,
'recommended': False,
'type': 'prepaid',
'updated_at': '2021-05-21 15:34:36',
'url': 'https://example.publica.la/subscribe/2696?signature={random_hash}'}}
/subscribe/2696?signature={random_hash}'}}
Update
PUT /integration-api/v1/dashboard/plans/{plan_id}
Request Body
Parameter | Type | Description. |
---|---|---|
type | string | Valid values: recurring , prepaid , Required |
name | string | |
details | string | |
duration | nullable, integer | |
recommended | boolean | |
private | boolean | |
assigns_collections | boolean | |
concurrency_limit | integer | |
collections | list of collections | |
download_files | boolean | |
customer | string | |
invoice | string | |
file_name | string | |
upload_file | file | |
prices | list of prices | |
free_trial | boolean | |
free_trial_days | integer | This field can be omited when free_trial is False |
{
"type":"recurring",
"name":"Demo Plan",
"details":"<div><!--block-->This is the description of the Demo Plan</div>",
"duration":null,
"recommended":true,
"private":false,
"assigns_collections":true,
"concurrency_limit":"1",
"collections":[
"Prepaid"
],
"download_files":false,
"customer":"",
"invoice":"",
"file_name":"",
"upload_file":false,
"prices":{
"ARS":0,
"USD":"1",
"EUR":0,
"MXN":"1",
"COP":0,
"PEN":0,
"CLP":0,
"AUD":0,
"UYU":0,
"BOB":0,
"PYG":0,
"BRL":0,
"INR":0,
"GTQ":0,
"HNL":0
},
"free_trial":true,
"free_trial_days":"15"
}
Response
Code | Desctiption |
---|---|
204 | Object Updated |
422 | Validation error, the reason of the error will be described in the response |
Same rules apply for assigning collections